package com.example.combwyaq.mvp.model.entity;

import com.google.gson.Gson;

import org.json.JSONArray;
import org.json.JSONException;

import java.util.ArrayList;
import java.util.List;

public class ChannelEntity extends BaseEntity {
    public String values;
    public List<Values> getValues(){
        if(values.isEmpty())
            return null;
        List<Values> list = new ArrayList<>();
        try {
            JSONArray jsonArray = new JSONArray(values);
            for (int i = 0;i < jsonArray.length();i ++){
                String str = jsonArray.getString(i);
                Values entity = new Gson().fromJson(str,Values.class);
                list.add(entity);
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return list;
    }

    public static class Values{
        public String channel_name;
        public long channel_id;
        public int channel_hot;
    }
}
